export default defineNuxtRouteMiddleware((to, from) => {
    console.log('middleware-global-auth=====kkkk')
    console.log(process,process.browser,'process.browser')

    if (process.client) { 
        console.log(window)
        let _isMobile = () => {
            let flag = window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
            return flag;
        }
        console.log(_isMobile(), 'isMobile')
        // if(_isMobile()){
        //     this.$router.push('/mobile/' + to.fullPath)
        // }
      }
    // let _isMobile = () => {
    //     let flag = window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
    //     return flag;
    // }
    //   let userAgent = req ? req.headers['user-agent'] : navigator.userAgent || ''
    // console.log(_isMobile(), 'isMobile')

    console.log(to, 'to')
    console.log(from, 'from')
})